package net.expectx.pay.gateway.common;





import net.expectx.common.single.util.PropertiesFileUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 代码生成类
 * @author lijian
 * @date 2018/7/21
 */
public class Generator {

	/**
	 * 根据命名规范，只修改此常量值即可
	 */
	/**
	 * 模块名
	 */

	private static String DATABASE = "e-x-pay";
	/**
	 * 表名前缀
	 */
	private static String TABLE_PREFIX = "merchant_payment_config";

	private static String PACKAGE_NAME = "net.expectx.pay.gateway";

	private static String JDBC_DRIVER = PropertiesFileUtil.getInstance("jdbc").get("jdbc.driver");

	private static String JDBC_URL = PropertiesFileUtil.getInstance("jdbc").get("jdbc.url");

	private static String JDBC_USERNAME = PropertiesFileUtil.getInstance("jdbc").get("jdbc.username");

	private static String JDBC_PASSWORD = PropertiesFileUtil.getInstance("jdbc").get("jdbc.password");

	/**
	 * 需要insert后返回主键的表配置，key:表名,value:主键名
	 */
	private static Map<String, String> LAST_INSERT_ID_TABLES = new HashMap<>();

	static {
		LAST_INSERT_ID_TABLES.put("merchant_payment_config", "id");
	}

	/**
	 * 自动代码生成
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		MybatisGeneratorUtil.generator(JDBC_DRIVER, JDBC_URL, JDBC_USERNAME, JDBC_PASSWORD,
				DATABASE, TABLE_PREFIX, PACKAGE_NAME, LAST_INSERT_ID_TABLES);

	}

}
